#! /bin/env python3
# coding: utf-8

import datetime
import time


def get_current_date_str():
    date = datetime.date.today().strftime("%Y-%m-%d")
    return date


def get_specific_date(interval, date_time='%Y-%m-%d'):
    if isinstance(interval, int):
        today = datetime.date.today()
        specific_date = (today + datetime.timedelta(days=interval)).strftime(date_time)
        return specific_date
    else:
        print("the type of parameters must be int")


def time_stamp2date_time(time_stamp):
    return datetime.datetime.fromtimestamp(time_stamp)


def date_time2time_stamp(date_time, date_format="%Y-%m-%d %H:%M:%S"):
    if isinstance(date_time, time.struct_time):
        time_stamp = time.mktime(date_time)
    else:
        date_time = datetime.datetime.strptime(date_time, date_format)
        time_stamp = int(time.mktime(date_time.timetuple()))
    return time_stamp


if __name__ == '__main__':
    print(get_specific_date(-1))
